package cn.byapps.hw.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Entity
@Table(name = "StudentFile")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "Assignment_type")
public class StudentFile implements Serializable {
    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    @Column(name = "id", length = 64)
    private String id;// 文件唯一id,uuid
    @Column(name = "fileName", length = 100)
    private String fileName;// 文件上传名称
    @Column(name = "filePath", length = 150)
    private String filePath;// 文件保存路径
    @Temporal(TemporalType.TIMESTAMP)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(name = "fileDate")
    private Date fileDate;// 上传时间
    @Column(name = "size", scale = 2) // 两位小数点
    private Double size;// 文件大小
    @Column(name = "md5", length = 100)
    private String md5;

}
